package p.a5;

public class Point {
	private double	x;
	private double	y;

	public Point(Point p) {
		this.x = p.getX();
		this.y = p.getY();
	}

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public Point(double x) {
		this.x = x;
		this.y = x;
	}

	public Point() {
		this.x = 0.0;
		this.y = 0.0;
	}

	public double getX() {
		return this.x;
	}

	public double getY() {
		return this.y;
	}

	public void setP(Point p) {
		this.x = p.getX();
		this.y = p.getY();
	}

	@Override
	public String toString() {
		return "P(" + this.x + "," + this.y + ")";
	}
	
	public void setXY(double x, double y) {
		this.x = x;
		this.y = y;
	}

	public void setX(double x) {
		this.x = x;
	}
	
	public void setY(double y) {
		this.y = y;
	}

	public Point rotate(Angle beta) {
		double nx = 0;
		double ny = 0;
		nx = ((this.x * Math.cos((beta.getAngle() * Math.PI) / 180)) - (this.y * Math.sin((beta.getAngle() * Math.PI) / 180)));
		ny = ((this.x * Math.sin((beta.getAngle() * Math.PI) / 180)) + (this.y * Math.cos((beta.getAngle() * Math.PI) / 180)));
		Point result = new Point(nx, ny);
		return result;
	}

}
